import { getUserInfo } from "../../utils/api";
import { getStorage } from "../../utils/util"
// pages/map/map.ts
Page({
  data: {
    longitude: 0,
    latitude: 0,
    markers: [],
  },
  // 获取当前位置
  async getShopAdress(data: any) {
    const res:any = await getStorage("userInfo");
    let markersObj: any = [
      {
        id: 999,
        longitude: res.userAddress_tb.longitude,
        latitude:  res.userAddress_tb.latitude,
        width: "20",
        height: "28",
        callout: {
          content: "我",
          color: '#f40',
          display: 'ALWAYS',
          bgColor: 'transparent'
        }
      },
      {
        id: 9999,
        longitude: data['x'],
        latitude: data['y'],
        width: "20",
        height: "28",
        callout: {
          content: data['name'],
          color: '#f40',
          display: 'ALWAYS',
          bgColor: 'transparent'
        }
      }]
    this.setData({
      longitude: data['x'],
      latitude: data['y'],
      markers: markersObj
    })
  },
  onLoad(e: any) {
    this.getShopAdress(e)
    console.log(e)
  },
})